<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  "use strict"; {
    const arr = [1, 2, 3];
    // 存在，等效于 > -1
    if (~arr.indexOf(3)) {
      console.log(`存在了`);
    }
    // 不存在，等效于 === -1
    !~arr.indexOf(1);
  };
</script>

</html>